package builder.example;

import java.sql.SQLClientInfoException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author：LJ
 * @Description：汽车模型抽象类
 * @Date: 2017/11/27
 * @Modified By:
 */
public abstract class CarModel {
    private List<String> sequence = new ArrayList<String>();

    protected abstract void start();

    protected abstract void stop();

    protected abstract void alarm();

    protected abstract void enginBoom();

    final public void run() {
        for (String item : sequence) {
            if (item.equalsIgnoreCase("start")) start();
            if (item.equalsIgnoreCase("stop")) stop();
            if (item.equalsIgnoreCase("alarm")) alarm();
            if (item.equalsIgnoreCase("enginBoom")) enginBoom();
        }
    }

    final public void setSequence(List<String> sequence) {
        this.sequence = sequence;
    }
}
